﻿using System;
using Me.Amon.M;

namespace Me.Amon.POS
{
    public class MPos : MObj
    {
        /// <summary>
        /// 对象索引
        /// </summary>
        public string id;
        /// <summary>
        /// 对象编码
        /// </summary>
        public string code;

        public string channel;

        public string terminal;

        public int status;

        public DateTime update_time;
        public string update_user;
        public DateTime create_time;
        public string create_user;

        public static string GetStatusName(object status)
        {
            if (status is int)
            {
                switch ((int)status)
                {
                    case CPos.STATUE_DEFAULT:
                        return "默认";
                    case CPos.STATUE_ENABLED:
                        return "启用";
                    case CPos.STATUS_DISABLED:
                        return "禁用";
                }
            }
            return "未知";
        }

        public override string GetError()
        {
            switch (error_code)
            {
                case PPos.ERROR_CODE_CUSTOM:
                    return error_message;
                case PPos.ERROR_CODE_OPT_EMPTY:
                    return "操作类型为空！";
                case PPos.ERROR_CODE_OPT_ERROR:
                    return "无效的操作类型！";
                case PPos.ERROR_CODE_DAT_EMPTY:
                    return "操作数据为空！";
                case PPos.ERROR_CODE_DAT_FORMAT:
                    return "无效的数据格式！";
                default:
                    return "未知的错误！";
            }
        }
    }
}
